package leetcode.easy;

/**
 * ClassName: $633_SumOfSquareNumbers
 * Description:
 * date: 2021-10-22 23:32
 *
 * @author liyifan
 */
public class $633_SumOfSquareNumbers {
    public boolean judgeSquareSum(int c) {
        long i = 0;
        long j = (int)Math.sqrt(c);

        while (i <= j) {
            long square = i * i + j * j;
            if (square == c) {
                return true;
            } else if (square > c)
                j--;
            else
                i++;
        }
        return false;
    }
}
